#ifndef CHATSERVER_H
#define CHATSERVER_H

#include <QWidget>
#include <QtNetwork>
#include <QtCore>

QT_BEGIN_NAMESPACE
namespace Ui { class ChatServer; }
QT_END_NAMESPACE

class ChatServer : public QWidget
{
    Q_OBJECT

public:
    ChatServer(QWidget *parent = nullptr);
    ~ChatServer();
public slots:
    void newConnection();           // 处理新连接
    void readyRead();               // 读取信息
    void disconnected();            // 断开连接
private:
    Ui::ChatServer *ui;
    QTcpServer *tcpServer;          // 服务器
    QList<QTcpSocket*> clients;     // 套接字列表
};
#endif // CHATSERVER_H
